package com.example.redis.moduel.controller;

import com.example.redis.moduel.exception.ExceptionBase;
import com.example.redis.moduel.response.ResponseDate;
import com.example.redis.moduel.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@PropertySource("exception.properties")
public class UserController {
       @Value(value = "${10001}")
       private String content;

       @Autowired
       private UserService userService;

       @RequestMapping("/ss/tt")
       @ResponseBody
       public ResponseDate setRedis() {
              //userService.testRedis();
              System.out.println(content);
              if ( true ) {
                     throw new ExceptionBase(50001);
              }
              return new ResponseDate(true);
       }

       @RequestMapping("/ss/get")
       @ResponseBody
       public ResponseDate getRedis() {
              userService.getRedis();
              return new ResponseDate("true");
       }
}
